function foo() {
    console.log(this.a)
}
var a = 1;
foo()

const obj = {
    a: 2,
    foo: foo
}
obj.foo()

const c = new foo()